package Interface;

import ulht.ia.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.EventListenerList;
import javax.swing.table.AbstractTableModel;
import javax.xml.crypto.dsig.spec.C14NMethodParameterSpec;
import sun.org.mozilla.javascript.internal.regexp.SubString;


public class TabelaTimetable extends AbstractTableModel {

        private ArrayList datalist = new ArrayList();     
        private String[] columns={
        "Hora",
        "Segunda", 
        "Terça", 
        "Quarta", 
        "Quinta",  
        "Sexta"};

    public TabelaTimetable() {
    }
       
    public void addHorario(Horario w) {
        datalist.add(w);
        fireTableDataChanged();
    }
  
    public void addHorarioList(List l) {
        datalist.addAll(l);
        fireTableDataChanged();
    }
    
    public Horario getHorarioAt(int row) {
        return (Horario)datalist.get(row);
    }
    
    public Horario removeHorarioAt(int row) {
        fireTableDataChanged();
        return (Horario)datalist.remove(row);
    }
    
    @Override
    public int getRowCount() {
        return datalist.size();
    }

    @Override
    public int getColumnCount() {
       return columns.length;
    }
    
    @Override
    public String getColumnName(int col) {
        return columns[col];
    }
    
    @Override
    public Object getValueAt(int row, int col) {
    {
        Horario horario = (Horario) datalist.get(row);
        switch (col)
        {
           /* case 0:
            return Horario.getIdHorario();
            case 1:
            return Horario.getIdRecibo(); 
            case 2: 
            return Horario.getNomeSistemaSaudeByID(Horario.getIdSistemaSaude());
            case 3:
            return Horario.getNomeMedicoByID(Horario.getIdmedico());
            case 4:
            return Horario.getNomePacienteByID(Horario.getIdpaciente());
            default:
            return null;*/
        }
        return 0;
    }
    }
    public void setListenerList(EventListenerList listenerList) {
        this.listenerList = listenerList;
    }

    @Override
    public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
        super.setValueAt(aValue, rowIndex, columnIndex);
    }  
}